<?php
class stat
{
	static function getCount($table)
	{
		$result = sys::sql("select count(*) as count from %s;", $table);
		return intval($result[0]['count']);
	}
	
	static function getTop($table='items', $id_field='user_id')
	{
		return sys::sql("select %s, count(*) as count from %s group by %s order by count desc limit 10",
			$id_field, $table, $id_field);
	}
}
